@isTest
private class WorkOrderProductPriceHandlerTest {
    static testMethod void testMethod1() {
        Account acc = TestUtils.createAccount();
		insert acc;

		Product__c pro = TestUtils.createProduct();
		pro.Price__c = 400;
		pro.Category0__c = '仪器';

		Product__c pro1 = TestUtils.createProduct();
		pro1.Price__c = 500;
		pro1.Category0__c = '仪器';

		insert pro;
		insert pro1;

		Case case1 = new Case(
			RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('Service', 'Case'),
			Account = acc,
			Origin = '电话',
			Status = '处理中',
			Manufacturer__c = pro.Id);
		insert case1;

		WorkOrder__c wo = new WorkOrder__c(
			RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('ServiceOrder', 'WorkOrder__c'),
			Case__c = case1.Id,
			Account__c = acc.Id,
			Status__c = '生单');
		insert wo;

		WorkOrder__c wo1 = new WorkOrder__c(
			RecordTypeId = Utils.getRecordTypeIdByDevNameAndObjName('ServiceOrder', 'WorkOrder__c'),
			Case__c = case1.Id,
			Account__c = acc.Id,
			Status__c = '生单');
		insert wo1;


        WorkOrderProduct__c wp1 = new WorkOrderProduct__c();
        wp1.WorkOrder__c = wo.Id;
        wp1.Product__c = pro.Id;
        wp1.Quantity__c = 1;
        wp1.ThisNegoPrice__c = 1000;
        wp1.FeeforTechnicalService__c = 500;
        insert wp1;

        wp1.Product__c = pro1.Id;
        update wp1;

        WorkOrderProduct__c wp2 = new WorkOrderProduct__c();
        wp2.WorkOrder__c = wo1.Id;
        wp2.Product__c = pro1.Id;
        wp2.Quantity__c = 2;
        wp2.ThisNegoPrice__c = 950;
        wp2.FeeforTechnicalService__c = 500;
        insert wp2;
    }
}